﻿@{
    ViewBag.Title = "修改密码";
}
@section header
{
    <style type="text/css">
        form
        {
            margin-top: 20px;
            margin-left: 10px;
        }

            form table tr td
            {
                height: 50px;
            }
    </style>
}
<form id="fmUpdatePassword" class="easyui-form">
    <table>
        <tr>
            <td>
                <label for="OldPassword">旧密码：</label>
            </td>
            <td>
                <input class="easyui-textbox" style="width: 250px; height: 40px; padding: 12px" name="OldPassword"
                    type="password" data-options="prompt:'旧密码',required:true,validType:'length[6,15]'">
            </td>
        </tr>
        <tr>
            <td>
                <label for="NewPassword">新密码：</label>
            </td>
            <td>
                <input class="easyui-textbox" style="width: 250px; height: 40px; padding: 12px" name="NewPassword"
                    type="password" data-options="prompt:'新密码',required:true,validType:'length[6,15]'">
            </td>
        </tr>
        <tr>
            <td>
                <label for="VerifyNewPassword">确认新密码：</label>
            </td>
            <td>
                <input class="easyui-textbox " style="width: 250px; height: 40px; padding: 12px" name="VerifyNewPassword"
                    type="password" data-options="prompt:'确认新密码',required:true,validType:'length[6,15]'">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <a href="javascript:void()" class="easyui-linkbutton c6"
                    data-options="iconCls:'icon-ok'" style="padding: 5px 0px; width: 100%;"
                    onclick="updatePassword()">
                    <span style="font-size: 14px;">提交</span>
                </a>
            </td>
        </tr>
    </table>
</form>
@section scripts
{
    <script type="text/javascript">
        function updatePassword() {
            var msgTitle = "修改密码";
            if ($('#fmUpdatePassword').form('enableValidation').form('validate')) {
                $.post('/account/updatepassword',
                    $('#fmUpdatePassword').serialize(),
                     function (data) {
                         var msg = '';
                         if (data.msg.length != 0) {
                             $.each(data.msg, function (index, item) {
                                 msg = msg + item + '<br/>';
                             });
                             $.messager.alert(msgTitle, msg, 'error');

                         }
                         else {
                             $.messager.alert(msgTitle, '更新成功！', 'info');
                         }
                     });
            }
        }
    </script>
}